unit Thrad_GetZBDFL;

interface

uses
  Classes,SysUtils,Class_KzThrad,Class_QBD_FL,UniConnct,Uni;

type
  TThradGetZBDFL = class(TKzThrad)
  public
    FQBDFL:TQBDFL;
    FINDEX:Integer;
  protected
    procedure Execute; override;
  end;

const
  CONST_MARK_ZBGL='ZBGL';

implementation
uses
  ActiveX;

{ Important: Methods and properties of objects in visual components can only be
  used in a method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

    procedure TThradGetZBDFL.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ TThradGetZBDFL }

procedure TThradGetZBDFL.Execute;
var
  SQLA:string;
  UniConnct:TUniConnection;
  UniDataSet:TUniQuery;
begin
  CoInitialize(nil);

  UniDataSet:=nil;
  
  try
    UniConnct:=UniConnctEx.GetConnection(CONST_MARK_ZBGL);
    //-<
    SQLA:=FQBDFL.EXPSQL;
    UniDataSet:=TQBDFL.GetDataSet(SQLA,UniConnct);
    GetMsgProgress('COUNT',[UniDataSet.RecordCount]);
    //->
  finally
    FreeAndNil(UniConnct);
    if UniDataSet<>nil then FreeAndNil(UniDataSet);
  end;        
  CoUninitialize;
end;

end.
